<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="/fuman/js/oversea.js"></script>
<title>EZGO美国仓</title>
<script type="text/javascript">
    function addstock()
    {
        $('#changstatusform').modal('show');
    }
    function changstock()
    {
        $('#changstockform').modal('show');
    }

    function stockout()
    {
        var vote_arr = document.getElementsByName("ppid[]");
        var idarr = new Array();
        var i=0;
        var str="";
        for(var j = 0; j < vote_arr.length; j++)
        {
            if(vote_arr[j].checked == true)
            {
                idarr[i] = vote_arr[j].value;
                str += vote_arr[j].value+",";
                i++;
            }

        }
        if(i<=0){
            alert("未选中数据");
        }else{
            $.post("/oversea/ajaxbutton", {"op": "stockout","str":str},
                    function(data){

                        if(data)
                        {
                            var tmp = "";
                            for(var i=0;i<data.length;i++)
                            {
                                tmp+="  <tr>";
                                tmp+=" <td class=\"head0\" width=15%>"+data[i].sku+"</td>";
                                tmp+=" <td class=\"head1\" width=35%>"+data[i].goodsname+"</td>";
                                tmp+=" <td class=\"head0\" width=25%>"+data[i].stock+"</td>";
                                tmp+=' <td class=\"head1\" width=25%><input type="text" name="nums[]" id="nums" class="width50" value="{{$li.check_id}}" placeholder="填写数字")"  /><input type="hidden" name="id[]"  class="width50" value='+data[i].id+' /><input type="hidden" name="sku[]"  class="width50" value='+data[i].sku+' /></td>';

                            }

                            $("#showlist").html(tmp);
                        }

                    },"json");
        }

        $('#stockoutform').modal('show');
    }
</script>
<body class="withvernav">
<div class="bodywrapper">
    {{include file='/public/leftmenu.tpl'}}
    <div class="centercontent tables">
        <div class="pageheader notab">
            <h1 class="pagetitle">EZGO美国仓</h1>
            <span class="pagedesc"></span>
        </div>
        <!--pageheader-->

        <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
        <div id="contentwrapper" class="contentwrapper">
            <!--搜索栏-->
            <form class="stdform stdform2" method="get" action="/overseaapi/usastocklist">
                <div class="tableoptions">

                    商品编号: <input type="text" name="other" id="other" class="width100" placeholder="请输入商品编号" value="{{$other}}" />
                    库存数: <input type="text" name="stockbegin" id="stockbegin" class="width100" placeholder="请输入库存数" value="{{$stockbegin}}" />
                    - <input type="text" name="stockend" id="stockend" class="width100" placeholder="请输入库存数" value="{{$stockend}}" />
                    <button class="btn btn_orange btn_search radius50">Search</button>
                    <!--
                    &nbsp;&nbsp;&nbsp;&nbsp;  <a href="javascript:void(0)" onClick="stockout(1)" class="btn btn2 btn_help"><span>出库</span></a>
                    -->
                </div>
            </form>
            <!--搜索栏结束-->

            <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
                <thead>
                <tr>
                    <!--<th class="head1">序号</th>-->
                    <th class="head1"><a href="/overseaapi/usastocklist?orderbyxuhao={{$orderbyxuhao}}">序号</a><span style="margin-top:15px;">&nbsp;&nbsp;<img src="/fuman/images/{{if $orderbyxuhao=='ASC'}}arrowdown{{else}}arrowup{{/if}}.png"> </span></th>
                    <!--<th class="head0">商品编号</th> -->
                    <th class="head0"><a href="/overseaapi/usastocklist?orderbysku={{$orderbysku}}">商品编号</a><span style="margin-top:15px;">&nbsp;&nbsp;<img src="/fuman/images/{{if $orderbysku=='ASC'}}arrowdown{{else}}arrowup{{/if}}.png"> </span></th>
                    <th class="head1">名称</th>
                    <!--
                    <th class="head0">库存数</th>
                    -->

                    <th class="head0"><a href="/overseaapi/usastocklist?orderbystock={{$orderbystock}}">美国仓库存数</a><span style="margin-top:15px;">&nbsp;&nbsp;<img src="/fuman/images/{{if $orderbysku=='ASC'}}arrowdown{{else}}arrowup{{/if}}.png"> </span></th>
                    <th class="head0">30天销量</th>
                    <th class="head1">待发数量</th>
                    <!--
                    <th class="head1">在途</th>

                    <th class="head1">添加时间</th>
                    -->
                </tr>
                </thead>
                <tbody>
                {{foreach from=$list item=li key=key}}
                <tr>
                    <td>{{$li.id}}</td>
                    <td><a href="/product/productlist?other={{$li.goods_sku}}" target="_blank">{{$li.goods_sku}}</a></td>
                    <td>{{$li.goods_name}}</td>
                    <td>{{$li.stock}}</td>
                    <td>{{$li.salecount}}</td>
                    <td class="center">{{$li.waitgoods}}</td>

                    <!--
                    <td>{{$li.TotalInStock}}</td>
                    -->
                    <!--
                    <td class="center">0</td>
                    <!--
                    <td class="center">{{$li.addtime}}</td>
                    -->
                </tr>
                {{/foreach}}
                </tbody>

            </table>
            <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
            <br />
            <br />
        </div>
    </div>
    <!--bodywrapper-->
    <!-- 模态框（Modal） SKU状态 -->
    <form action="/oversea/ajaxbutton?op=addstock"  method="post" name="otherforms" id="otherforms" >
        <div class="modal fade" id="changstatusform" tabindex="-1" role="dialog" aria-labelledby="schangstatusform" aria-hidden="true">
            <div class="modal-dialog" style="width:740px;">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"
                                aria-hidden="true">× </button>
                        <h4 class="modal-title" id="schangstatusform">入库操作 </h4>
                    </div>
                    <div class="modal-body">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td>SKU(一行一个):<textarea name="sku" id="sku" cols="50" rows="5" class="longinput"></textarea>
                                </td>
                            </tr>

                        </table>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default"
                                    data-dismiss="modal"> 关闭 </button>
                            <button type="submit" class="btn btn-primary" > 提交 </button>
                        </div>
                    </div>
                    <!-- /.modal-content -->
                </div>
                <!-- /.modal-dialog -->
            </div>
        </div>
    </form>
    <!-- 模态框（Modal）状态结束 -->
    <!-- 模态框（Modal）出库操作 -->
    <form action="/oversea/ajaxbutton?op=changstockform"  method="post" name="otherforms" id="otherforms" >
        <div class="modal fade" id="changstockform" tabindex="-1" role="dialog" aria-labelledby="schangstockform" aria-hidden="true">
            <div class="modal-dialog" style="width:740px;">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"
                                aria-hidden="true">× </button>
                        <h4 class="modal-title" id="schangstockform">盘点 </h4>
                    </div>
                    <div class="modal-body">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td>SKU(格式一行一个： SKU，数量；如 130149-XL,1):<textarea name="sku" id="sku" cols="50" rows="5" class="longinput"></textarea>
                                </td>
                            </tr>

                        </table>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default"
                                    data-dismiss="modal"> 关闭 </button>
                            <button type="submit" class="btn btn-primary" > 提交 </button>
                        </div>
                    </div>
                    <!-- /.modal-content -->
                </div>
                <!-- /.modal-dialog -->
            </div>
        </div>
    </form>
    <!-- 模态框（Modal）状态结束 -->

    <!-- 模态框（Modal） 盘点操作 -->
    <form action="/oversea/ajaxbutton?op=savestockout"  method="post" name="otherforms" id="otherforms" >
        <div class="modal fade" id="stockoutform" tabindex="-1" role="dialog" aria-labelledby="sstockoutform" aria-hidden="true">
            <div class="modal-dialog" style="width:740px;">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"
                                aria-hidden="true">× </button>
                        <h4 class="modal-title" id="sstockoutform">出库操作 </h4>
                    </div>
                    <div class="modal-body">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <th class="head0">SKU</th>
                                <th class="head1">商品名称</th>
                                <th class="head0">库存数</th>
                                <th class="head0">需要出库数</th>
                            </tr>
                            <tbody>
                            <tr><td colspan="4">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <div style="width:100%;height:400px; overflow-y:scroll; border:0px solid;">
                                            <span id="showlist"></span>
                                        </div>
                                    </table>
                                </td></tr>

                            </tbody>
                        </table>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default"
                                    data-dismiss="modal"> 关闭 </button>
                            <button type="submit" class="btn btn-primary" > 提交 </button>
                        </div>
                    </div>
                    <!-- /.modal-content -->
                </div>
                <!-- /.modal-dialog -->
            </div>
        </div>
    </form>
    <!-- 模态框（Modal）状态结束 -->
</body>
</html>